/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.icons;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;

/**
 * @author zl
 *
 */
public class ModelerUIIcons {
private static final Map stringToImage = new HashMap();
	public static final String PROJECT_IMG = "project.ICO";
	public static final String PROJECT_CLOSED_IMG = "project_closed.GIF";
	public static final String FOLDER_IMG = "folder.ICO";
	public static final String FILE_IMG = "file.ICO";
	public static final String MODEL_VIEW = "modelView.gif";
	public static final String DIAGRAM = "diagram.gif";
	public static final String UNKNOWN = "unKnown.gif";
	
	public static final String CLASS_ENTRY = "class.gif";
	public static final String TEMPLATENODE_ENTRY = "newModel.gif";
	public static final String INTERFACE_ENTRY = "interface_entry.gif";
	public static final String COMMENT = "comment.gif";
	public static final String COMMENT_ENTRY = "comment_entry.gif";
	public static final String ASSOCIATION_ENTRY = "association_entry.gif";
	public static final String GENERALIZATION_ENTRY = "association_entry.gif";
	public static final String PACKAGE_ENTRY = "package_entry.gif";
	public static final String PACKAGE = "package_entry.gif";
	public static final String RELATION = "relation.gif";
	public static final String PROJECT = "project.gif";
	public static final String FOLDER = "folder.gif";
	public static final String ATTRIBUTE = "attribute.gif";
	public static final String ENUM = "enum.gif";
	public static Image getImage(String key) {
		Image img = (Image)stringToImage.get(key);
		if (img == null) {
			img = getImageDescriptor(key).createImage();
			stringToImage.put(key, img);
		}
		return img;
	}

	public static ImageDescriptor getImageDescriptor(String key) {
		return ImageDescriptor.createFromFile(ModelerUIIcons.class, key);
	}
}
